#include <iostream>
#include <stdlib.h>
#include <time.h>

using namespace std;

int main()
{
    int timeNow = time(NULL);
    srand(timeNow);
    int playerGuess;
    int compNumber;
    int playerScore = 0;
    int compScore = 0;
    do {
        cout << "Guess 0 or 1: ";
        cin >> playerGuess;
        compNumber = rand() % 2;
        if(playerGuess == compNumber)
        {
            playerScore++;
            cout << "You won 1 point!" << endl;
        }
        else
        {
            compScore++;
            cout << "The computer won 1 point" << endl;
        }

        cout << "Score is " << playerScore << " : " << compScore << endl<< endl;
    } while (playerScore < 5 && compScore < 5);

    if(playerScore == 5)
    {
        cout << "YOU WON THE GAME!";
    }
    else
    {
        cout << "You lost the game!";
    }
    return 0;
}
